import { QUAN_DATAS } from "../../Action/credit/educalculation";

import objectAssign from "object-assign";
import {isServer} from "../../../tools/utils";
const _quanInfoData = {
	amount: "", //额度
	billDay: "", ////账单还款日
	rtnDay: "", //还款日期
	pushMessage: "0", //0-不弹框 1-弹框
	list: [] //弹窗中的优惠券
};
const quanInfoData = isServer ? _quanInfoData : sessionStorage.getItem("quanInfoData")
	? JSON.parse(sessionStorage.getItem("quanInfoData"))
	: _quanInfoData;
const getQuanDatas = (state = quanInfoData, action = {}) => {
	switch (action.type) {
		case QUAN_DATAS:
			sessionStorage.setItem(
				"quanInfoData",
				JSON.stringify(objectAssign({}, state, action.options))
			);
			return objectAssign({}, state, action.options);
		default:
			return state;
	}
};
export { getQuanDatas };
